#include<iostream>
#include<string>
#include<sys/types.h>
#include<sys/time.h>
#include<unistd.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<sys/stat.h>
#include<cstdio>
#include<cstring>
#include<fcntl.h>
#include<signal.h>
#include<pthread.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<netinet/in.h>
#include<vector>
#include<arpa/inet.h>
#include<sys/wait.h>
#include<functional>
#include <semaphore.h>
#include<jsoncpp/json/json.h>
#include<sys/select.h>
#include<memory>
#include"HttpServer.hpp"
#include"Log.hpp"

using namespace std;
static void Usage(string str)
{
    cout<<"Usage Error: "<<endl<<str<<" "<<"port"<<endl;
    exit(4);
}
int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        Usage(argv[0]);
    }
    int port=atoi(argv[1]);
    shared_ptr<HttpServer> svr(new HttpServer(port));
    svr->InitServer();
    svr->Loop();
    return 0;
}